package crm.view.masterMagment;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JToolBar;
import javax.swing.SpringLayout;

import crm.controller.ActionNameManagmentController;
import crm.controller.EnquiryFormController;
import crm.controller.FollowUpActionsController;
import crm.controller.InfoSourceManagmentController;
import crm.controller.InquiryManagmentController;
import crm.controller.LeadHomeController;
import crm.controller.PriorityManagmentController;
import crm.controller.ProductManagmentController;
import crm.controller.SalesManagmentController;
import crm.view.leeds.EnquiryFormView;
import crm.view.leeds.FollowupActionsView;
import crm.view.leeds.LeadHomeView;
import crm.viewframework.UIFrameWork;

public class ManagmentView extends JPanel implements MouseListener
{
	private static final long serialVersionUID = 1L;
	private SpringLayout springLayout;
	private JToolBar toolBar;
	public ManagmentView() 
	{
		springLayout = new SpringLayout();
		setLayout(springLayout);
		toolBar=UIFrameWork.addToolBar(this, springLayout);
		String[]leftMenuNames={"Priority Managment","Product Managment","InfoSource Managment","InquiryState Managment","SalesPerson Managment","ActionName Managment"};
		JLabel[]leftMenu=UIFrameWork.setLeftMenu(leftMenuNames,toolBar, new Dimension(180, 40));
	    Font font=new Font("MS Reference Sans Serif", Font.PLAIN, 13);
	    UIFrameWork.styleLeftMenu(leftMenu, font, null,null);
		}
	@Override
	public void mouseClicked(MouseEvent arg0) {
		// TODO Auto-generated method stub
		if(arg0.getSource() instanceof JLabel)
		{
			JLabel label=(JLabel) arg0.getSource();
			if(label.getText().equals("Priority Managment"))
			{
				MasterManagment view=new MasterManagment();
				
				UIFrameWork.setFormComponent(springLayout,view,this,2);
				
				try {
					PriorityManagmentController con=new PriorityManagmentController(view, null);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				
			}
			if(label.getText().equals("Product Managment"))
			{
				
				MasterManagment view=new MasterManagment();
				UIFrameWork.setFormComponent(springLayout,view,this,2);
				
				try {
					ProductManagmentController con=new ProductManagmentController(view, null);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			if(label.getText().equals("InfoSource Managment"))
			{
				MasterManagment view=new MasterManagment();
				UIFrameWork.setFormComponent(springLayout,view,this,2);
				InfoSourceManagmentController con=new InfoSourceManagmentController(view,null);	
			}
			if(label.getText().equals("InquiryState Managment"))
			{
				InquiryManagment view=new InquiryManagment();
				UIFrameWork.setFormComponent(springLayout,view,this,2);
				InquiryManagmentController con=new InquiryManagmentController(view, null);
			}
			if(label.getText().equals("SalesPerson Managment"))
			{
				MasterManagment view=new MasterManagment();
				UIFrameWork.setFormComponent(springLayout,view,this,2);
				SalesManagmentController con=new SalesManagmentController(view,null);	
			}
			if(label.getText().equals("ActionName Managment"))
			{
				MasterManagment view=new MasterManagment();
				UIFrameWork.setFormComponent(springLayout,view,this,2);
				ActionNameManagmentController con=new ActionNameManagmentController(view,null);	
			}
			
			
		}
		
	}
	@Override
	public void mouseEntered(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void mouseExited(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void mousePressed(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void mouseReleased(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}
}



